package com.wlient.basic.Stream;

import com.wlient.basic.jvm.entity.User;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

/**
 * @author: 史炜立
 * @description: TODO
 * @date: 2021/10/26 15:20
 */
public class count {


    public static void main(String[] args) {
        List<user> users = insertData.insertUser();
        Map<Integer, List<user>> u = users.stream().collect(Collectors.groupingBy(user::getHeight, Collectors.toList()));
        u.forEach((k, v) -> {
            System.out.println(k + ":" + v);
        });


        HashMap<Integer, String> map1 = new HashMap<>();
        map1.put(1, "A");
        map1.put(2, "B");
        map1.put(3, "C");
        HashMap<Integer, String> map2 = new HashMap<>();
        map2.put(1, "A");
        map2.put(2, "C");
        map2.put(3, "C");
        map2.put(4, "D");
        HashMap<Integer, String> map3 = new HashMap<>();
        map3.putAll(map1);
        map3.putAll(map2);
        map3.forEach((k, v) -> {
            System.out.println(k + ":" + v);
        });
    }
}
